//
//  MyButton.m
//  day6作业 画板
//
//  Created by tyw on 15/8/5.
//  Copyright (c) 2015年 tyw. All rights reserved.
//

#import "MyButton.h"

@implementation MyButton


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        _label = [[UILabel alloc] initWithFrame:self.bounds];
        _label.textColor = [UIColor blackColor];
        _label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_label];
    }
    
    return self;
}

- (void)setTitle:(NSString *)title {
    _title = title;
    
    _label.text = _title;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    _block();
}

@end
